<include file="Common/header" />
<title>添加检测点</title>
</head>
<body>
<div class="pd-20">
	<form action="" method="post" class="form form-horizontal" id="form-user-character-add">
		<div class="panel panel-primary">
			<div class="panel-header">基本信息</div> 
			<div class="panel-body">
				<div class="row cl">
					<label class="form-label col-2"><span class="c-red">* </span>设备编号：</label>
					<div class="formControls col-2">
						<input type="text" class="input-text radius" value="{$info['blue_name']}" id="blue_name" name="blue_name">
					</div>

					<label class="form-label col-2"><span class="c-red">* </span>检测点名称：</label>
					<div class="formControls col-2">
						<input type="text" class="input-text radius" value="{$info['blue_nick']}" id="blue_nick" name="blue_nick">
					</div>
				</div>
			</div>
		</div>
		
		<table class="table table-border table-bordered pt-5">
			<tr class="text-c">
				<td>
					<button type="button" class="btn btn-success radius roleSubmit"><i class="icon-ok"></i> 确定</button>
				</td>
			</tr>
		</table>
		<input type="hidden" id="blue_id" name="blue_id" value="{$info['blue_id']}" />
	</form>
</div>

<script>
	$(document).ready(function(){
		$(".roleSubmit").on('click', function(){
			/**
			 * 验证参数
			 **/
			var blue_name = $("#blue_name").val();
			if(!blue_name.length){
				layer.msg('请输入设备名', {icon: 5, time: 2000});
				return false;
			}
			
			var blue_nick = $("#blue_nick").val();
			if(!blue_nick.length){
				layer.msg('请输入检测点名称', {icon: 5, time: 2000});
				return false;
			}
			
			$.post('index.html', $("#form-user-character-add").serialize(), function(data){
				if(data == '操作成功'){
					layer.msg('操作成功', {icon: 1, time: 2000}, function(){
						window.parent.location.reload(); //刷新
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	                    parent.layer.close(index);
					});
				}else{
					layer.msg(data, {icon: 2, time: 2000});
				}
			});
		});
	});
</script>
</body>
</html>